# -*- coding: utf-8 -*-
<%inherit file="/layouts/htmlPage.html" />

### Template for content pages
<%def name="body()">
	<%include file="/shared/flash_messages.html"/>
        <%include file="/shared/header.html"/>
        <div id="container">
        <div id="lhs">
            ${next.lhs()}
        </div>
        <div id="rhs">
            ${self.rhs()}
        </div>
        </div>
        <%include file="/shared/footer.html"/>
</%def>


<%def name="rhs()">
% if not username:
    <div id="user_login_header">User Account</div><!-- end user_login_header-->    
    <form id="fm-log-in" action="/account/login" method="post">
    <div id="field_username">
        <strong>Email:</strong>
            <input type="text" id="email" name="email"/>
    </div>
         
    <div id="field_password">
        <strong>Password:</strong>
        <input type="password" id="password" name="password"/>
    </div>
    </form>
    <button id="bt-log-in">log in</button>
    <button id="bt-register">register</button>
    <button id="bt-forget">forget</button>
    <button id="bt-google">login via google?</button>
% else:
    <div id="user_login_header">User</div><!-- end user_login_header-->    
    <div>
    <div style="font-weight:bold; margin-bottom:10px;">Welcome back to Jiang You! ${username}</div>
        <button id="bt-log-out">Log Out</button>
        <button id="bt-change_password">Change Password</button>
        <button id="bt-profile">View Profile</button>
    </div>
% endif

</%def>

<%def name="user_script()">
        $("button#bt-forget").click(function(){
            window.location.replace("/account/forgetpassword");
        });
        $("button#bt-register").click(function(){
            window.location.replace("/account/signup");
        });
        $("button#bt-log-in").click(function(){
            $("#fm-log-in").submit();
        });
        $("button#bt-google").click(function(){
            window.location.replace("/account/googlelogin");
        });

        $("button#bt-log-out").click(function(){
            window.location.replace("/account/logout");    
        });
        $("button#bt-change-password").click(function(){
            window.location.replace("/account/changepassword");    
        });
        $("button#bt-profile").click(function(){
            window.location.replace("/profile");    
        });
</%def>

<%def name="jquery_script()">
</%def>
